home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Know Your Soccer
/
Know Your Soccer.iso
/
Soccer
/
DIRECTOR
/
KTGCST.CST
/
00045_Script_PopUpMenu Script--using Movie in a window
< prev
next >
Wrap
Text File
|
1998-10-16
|
4KB
|
143 lines
-- the popup menu is a separate movie that is openined over the current movie
-- the global gPop stores the name of the popup window
global gPop,gPopButtonState,gSubPop
-- launches and positions the popup menu
-- popname = file name & the window's name
-- posV = the window's vertical position
-- posh = the window's horizontal position
-- W = width
-- h = height
-- level defines which pop menus will close
-- level 1 all
-- level 2 only those above 1 etc.
on InitPopMenu popname,posV,posH,W,H,level
puppetsound 0
resetbanner
if voidp(gpop) then set gpop = []
losePop (window level)
if the result > 0 then exit
set temp = window popname
set the filename of temp to popname
set the windowtype of temp to 2
FindCurentStageLocation posV,posH,W,H, temp
open temp
-- check to see if it is has been created
-- pause the correct windows
-- I didn't use the window list to this
set c = getone(gPop temp)
if c = 0 then append gPop temp
set s = getone(gPop temp)
case s of
1: tell the stage to pause
set the mousedownscript to "limitedfunction"
2:
tell getat(gpop,1) to set the mousedownscript to "limitedfunctionPoP"
tell getat(gpop,1) to pause
3:
tell getat(gpop,2) to pause
end case
end
-- examines the current location of the stage then positions the popup window correctly
on FindCurentStageLocation posV,posH,W,H,temp
set x = the rect of the stage
set topX = posH+value(the left of x) -- position on stage offset by the stage pos on the screen
set topY = PosV+value(the top of x)-- position on stage offset by the stage pos on the screen
set BottomX = H+topX-- bottom corner = top corner plus desired window size (in bold)
set BottomY = W+TopY--bottom corner = top corner plus desired window size (in bold)
-- set BottomLeft = value(item 3 of temp)
-- set BottomRight = value(item 4 of temp)
set the rect of temp to rect(TopX,TopY,BottomX,BottomY)
end
-- closes all the popup menus
on LosePop level
if gpop = [] then
return 0
exit
end if
-- if the exit is present when subpop called close it first
set a =getone(gPop,(window "exit"))
if level = (window "subpop") and a > 0 then
Close (window "exit")
Forget (window "exit")
deleteat(gPop,a)
end if
set start = getone(gPop,level)
if start = 0 then exit
set range = count(gPop)
repeat with x = range down to start
set popout = getat(gPop,x)
Close popout
forget popout
end repeat
repeat with x = range down to start
deleteat(gPop,x)
end repeat
-- check to see what windows still exist and make the top one
-- active again
set t = count(gPop)
case t of
0: continue
bgmusic
resetbanner
set the mousedownscript to EMPTY
1:
set active = getat(gpop,1)
tell active to continue
2:
set active = getat(gpop,2)
tell active to continue
end case
return start
end
-- this script is assigned to the mousedown for the stage when a pop
-- menu is open and dismissed when it is closed
-- it only allows clicks to the background and the ball button to
-- dismiss the pop menus
-- this script is assigned to the mousedown for the stage when a pop
-- menu is open and dismissed when it is closed
-- it only allows clicks to the background and the ball button to
-- dismiss the pop menus
-- variables
-- a = a list containing the sprite numbers of buttons to exempt
-- b = the current button clicked
on limitedfunction
set a =[1,39]
set b = the clickon
repeat with x in a
set t = x
if b = t then
set exempt = 1
exit repeat
end if
end repeat
if exempt = 1 then
continue
Pass
else
losepop(window "pop")
dontPassEvent
end if
end